/**
 * <copyright>
 * </copyright>
 *

 */
package br.ufpe.cin.plp.eseml.impl;

import br.ufpe.cin.plp.eseml.EsemlPackage;
import br.ufpe.cin.plp.eseml.Hypothesis;
import br.ufpe.cin.plp.eseml.HypothesisLeftOperand;
import br.ufpe.cin.plp.eseml.HypothesisRightOperand;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Hypothesis</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link br.ufpe.cin.plp.eseml.impl.HypothesisImpl#getId <em>Id</em>}</li>
 *   <li>{@link br.ufpe.cin.plp.eseml.impl.HypothesisImpl#getLeftOperand <em>Left Operand</em>}</li>
 *   <li>{@link br.ufpe.cin.plp.eseml.impl.HypothesisImpl#getEqualitySignal <em>Equality Signal</em>}</li>
 *   <li>{@link br.ufpe.cin.plp.eseml.impl.HypothesisImpl#getHypothesisRightOperand <em>Hypothesis Right Operand</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class HypothesisImpl extends MinimalEObjectImpl.Container implements Hypothesis
{
  /**
   * The default value of the '{@link #getId() <em>Id</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getId()
   * @generated
   * @ordered
   */
  protected static final String ID_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getId() <em>Id</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getId()
   * @generated
   * @ordered
   */
  protected String id = ID_EDEFAULT;

  /**
   * The cached value of the '{@link #getLeftOperand() <em>Left Operand</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getLeftOperand()
   * @generated
   * @ordered
   */
  protected HypothesisLeftOperand leftOperand;

  /**
   * The default value of the '{@link #getEqualitySignal() <em>Equality Signal</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getEqualitySignal()
   * @generated
   * @ordered
   */
  protected static final String EQUALITY_SIGNAL_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getEqualitySignal() <em>Equality Signal</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getEqualitySignal()
   * @generated
   * @ordered
   */
  protected String equalitySignal = EQUALITY_SIGNAL_EDEFAULT;

  /**
   * The cached value of the '{@link #getHypothesisRightOperand() <em>Hypothesis Right Operand</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getHypothesisRightOperand()
   * @generated
   * @ordered
   */
  protected HypothesisRightOperand hypothesisRightOperand;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected HypothesisImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return EsemlPackage.Literals.HYPOTHESIS;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getId()
  {
    return id;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setId(String newId)
  {
    String oldId = id;
    id = newId;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EsemlPackage.HYPOTHESIS__ID, oldId, id));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public HypothesisLeftOperand getLeftOperand()
  {
    return leftOperand;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetLeftOperand(HypothesisLeftOperand newLeftOperand, NotificationChain msgs)
  {
    HypothesisLeftOperand oldLeftOperand = leftOperand;
    leftOperand = newLeftOperand;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EsemlPackage.HYPOTHESIS__LEFT_OPERAND, oldLeftOperand, newLeftOperand);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setLeftOperand(HypothesisLeftOperand newLeftOperand)
  {
    if (newLeftOperand != leftOperand)
    {
      NotificationChain msgs = null;
      if (leftOperand != null)
        msgs = ((InternalEObject)leftOperand).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EsemlPackage.HYPOTHESIS__LEFT_OPERAND, null, msgs);
      if (newLeftOperand != null)
        msgs = ((InternalEObject)newLeftOperand).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EsemlPackage.HYPOTHESIS__LEFT_OPERAND, null, msgs);
      msgs = basicSetLeftOperand(newLeftOperand, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EsemlPackage.HYPOTHESIS__LEFT_OPERAND, newLeftOperand, newLeftOperand));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getEqualitySignal()
  {
    return equalitySignal;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setEqualitySignal(String newEqualitySignal)
  {
    String oldEqualitySignal = equalitySignal;
    equalitySignal = newEqualitySignal;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EsemlPackage.HYPOTHESIS__EQUALITY_SIGNAL, oldEqualitySignal, equalitySignal));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public HypothesisRightOperand getHypothesisRightOperand()
  {
    return hypothesisRightOperand;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetHypothesisRightOperand(HypothesisRightOperand newHypothesisRightOperand, NotificationChain msgs)
  {
    HypothesisRightOperand oldHypothesisRightOperand = hypothesisRightOperand;
    hypothesisRightOperand = newHypothesisRightOperand;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EsemlPackage.HYPOTHESIS__HYPOTHESIS_RIGHT_OPERAND, oldHypothesisRightOperand, newHypothesisRightOperand);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setHypothesisRightOperand(HypothesisRightOperand newHypothesisRightOperand)
  {
    if (newHypothesisRightOperand != hypothesisRightOperand)
    {
      NotificationChain msgs = null;
      if (hypothesisRightOperand != null)
        msgs = ((InternalEObject)hypothesisRightOperand).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EsemlPackage.HYPOTHESIS__HYPOTHESIS_RIGHT_OPERAND, null, msgs);
      if (newHypothesisRightOperand != null)
        msgs = ((InternalEObject)newHypothesisRightOperand).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EsemlPackage.HYPOTHESIS__HYPOTHESIS_RIGHT_OPERAND, null, msgs);
      msgs = basicSetHypothesisRightOperand(newHypothesisRightOperand, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, EsemlPackage.HYPOTHESIS__HYPOTHESIS_RIGHT_OPERAND, newHypothesisRightOperand, newHypothesisRightOperand));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case EsemlPackage.HYPOTHESIS__LEFT_OPERAND:
        return basicSetLeftOperand(null, msgs);
      case EsemlPackage.HYPOTHESIS__HYPOTHESIS_RIGHT_OPERAND:
        return basicSetHypothesisRightOperand(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case EsemlPackage.HYPOTHESIS__ID:
        return getId();
      case EsemlPackage.HYPOTHESIS__LEFT_OPERAND:
        return getLeftOperand();
      case EsemlPackage.HYPOTHESIS__EQUALITY_SIGNAL:
        return getEqualitySignal();
      case EsemlPackage.HYPOTHESIS__HYPOTHESIS_RIGHT_OPERAND:
        return getHypothesisRightOperand();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case EsemlPackage.HYPOTHESIS__ID:
        setId((String)newValue);
        return;
      case EsemlPackage.HYPOTHESIS__LEFT_OPERAND:
        setLeftOperand((HypothesisLeftOperand)newValue);
        return;
      case EsemlPackage.HYPOTHESIS__EQUALITY_SIGNAL:
        setEqualitySignal((String)newValue);
        return;
      case EsemlPackage.HYPOTHESIS__HYPOTHESIS_RIGHT_OPERAND:
        setHypothesisRightOperand((HypothesisRightOperand)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case EsemlPackage.HYPOTHESIS__ID:
        setId(ID_EDEFAULT);
        return;
      case EsemlPackage.HYPOTHESIS__LEFT_OPERAND:
        setLeftOperand((HypothesisLeftOperand)null);
        return;
      case EsemlPackage.HYPOTHESIS__EQUALITY_SIGNAL:
        setEqualitySignal(EQUALITY_SIGNAL_EDEFAULT);
        return;
      case EsemlPackage.HYPOTHESIS__HYPOTHESIS_RIGHT_OPERAND:
        setHypothesisRightOperand((HypothesisRightOperand)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case EsemlPackage.HYPOTHESIS__ID:
        return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
      case EsemlPackage.HYPOTHESIS__LEFT_OPERAND:
        return leftOperand != null;
      case EsemlPackage.HYPOTHESIS__EQUALITY_SIGNAL:
        return EQUALITY_SIGNAL_EDEFAULT == null ? equalitySignal != null : !EQUALITY_SIGNAL_EDEFAULT.equals(equalitySignal);
      case EsemlPackage.HYPOTHESIS__HYPOTHESIS_RIGHT_OPERAND:
        return hypothesisRightOperand != null;
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (id: ");
    result.append(id);
    result.append(", equalitySignal: ");
    result.append(equalitySignal);
    result.append(')');
    return result.toString();
  }

} //HypothesisImpl
